/*
 * @Author: 飞越疯人院 353362604@qq.com
 * @Date: 2022-09-13 10:26:33
 * @LastEditors: 飞越疯人院 353362604@qq.com
 * @LastEditTime: 2022-12-28 14:36:54
 * @FilePath: \adminstration\src\Common\Router\MenuNavList\GraphicProgress\EngineeringListOrganization.jsx
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */

import { API_LIST } from '../../../Api/Api'
import { commonTableList } from '../Common/common'
import { AddDataButton, ModDataButton, DelDataButton } from '../Common/options'

export const EngineeringListOrganization = async ({ url, OptionsEvent, ClientData, Permission }) => {
    let data = {
        type: '形象进度',
        pageSize: 10,
        params: { pageIndex: 1 },
        get: API_LIST()[`get${url}`],
        added: `pos${url}`,
        modify: `put${url}`,
        delete: `del${url}`,
        options: [
            Permission?.findIndex(v => v.uuid === '7fbd9507-7feb-4232-8cd4-b1c604115a91') !== -1 && (
                <AddDataButton
                    OptionsEvent={OptionsEvent}
                    url={url}
                    type="primary"
                    icon="add"
                    title="新增标段形象进度"
                />
            ),
        ],
        columns: [
            commonTableList.uuid,
            { ...commonTableList.SearchSort, selectType: 'EngineeringListOrganization' },
            { ...commonTableList.organizationUuid, valueEnum: ClientData.organization },
            {
                dataIndex: 'engineeringListUuid',
                title: '形象进度',
                valueType: 'select',
                valueEnum: ClientData.engineeringList,
                rules: true,
                width: 200,
            },
            {
                dataIndex: 'amount',
                title: '工程量',
                valueType: 'inputNumber',
                rules: true,
                hideInSearch: true,
                width: 200,
            },
            commonTableList.createUserName,
            commonTableList.createTime,
            commonTableList.updateUserName,
            commonTableList.updateTime,
            {
                title: '操作',
                valueType: 'systemOperation',
                fixed: 'right',
                width: 200,
                hideInSearch: true,
                hideInAdded: true,
                hideInModify: true,
                render: (_, record) => {
                    return [
                        Permission.findIndex(v => v.uuid === 'e0bdc5bf-4fee-4aeb-a4d6-efabd8318fd0') !== -1 && (
                            <ModDataButton
                                OptionsEvent={OptionsEvent}
                                key="modify"
                                title="修改"
                                url={url}
                                data={record}
                            />
                        ),
                        Permission.findIndex(v => v.uuid === '21b39065-78f6-4102-8772-b4f55d0a1f5e') !== -1 && (
                            <DelDataButton
                                OptionsEvent={OptionsEvent}
                                key="delete"
                                title="删除"
                                url={url}
                                uuid={record.uuid}
                            />
                        ),
                    ]
                },
            },
        ],
    }
    return data
}
